// 赋值时需要特殊处理的表单字段
export const specialFieldList = ['apl_admre_audit#firstremark', 'apl_admre_audit#secondremark', 'apl_admre_audit#thirdremark', 'apl_admre_audit#fourthremark', 'apl_admre_audit#fiveremark', 'apl_condeploy_cert#countymsg', 'apl_condeploy_cert#citymsg']
// 表单控件数据
export let formControl = {}
// 业务字段表单输入回显到弹框意见
export function Bus_FieldService(applyid, field, value, _this, store) {
  console.log('field', value)
  // _this.$set(_this.$store.state.Processform.formData, field, value)
  // _this.$store.state.Processform.formData[field] = value
  _this.$set(_this.$store.state.Processform.formData, field, value)
  // _this.$set(_this.formData, field, value)
  if (specialFieldList.includes(field)) {
    updateOpinion(applyid, value, _this, store)
  } else {
    console.error('未知的特殊赋值字段', field)
  }
}

// 业务字段输入回显弹出输入框
export function Form_FieldService(value, _this) {
  // console.log('formControl', formControl)
  // console.log('回显到表单控件', value)
  if (_this.$route.params.taskName == '科领导意见') {
    _this.$store.state.Processform.formData['apl_admre_audit#secondremark'] = value
    return
  }
  for (let key in formControl) {
    // 如果在定义的业务字段内, 且没有隐藏和禁用则控件等于输入框的值
    if (specialFieldList.includes(key) && formControl[key].options.hidden == false && formControl[key].options.disabled == false) {
      _this.$store.state.Processform.formData[key] = value
      break
    }
  }
}

async function updateOpinion(applyid, value, _this, store) {
  if (_this.$route.params.taskName == '科领导意见') {
    store.opinion.opinion = _this.$store.state.Processform.formData['apl_admre_audit#secondremark']
  } else {
    store.opinion.opinion = value
  }
  console.log('更新弹框', store.opinion.opinion)
}